package com.gp.controller;

import com.gp.service.CarBrandService;
import com.gp.entity.TbBrand;
import com.gp.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("rent/carBrand")
public class CarBrandController {

    @Autowired
    private CarBrandService carBrandService;

    @PostMapping("findAll")
    public CommonResult findAll(Integer page, Integer limit, String name){
        return carBrandService.findAll(page, limit, name);
    }

    @DeleteMapping("delCarById")
    private CommonResult eleteByIdd(Integer id){
        return carBrandService.deleteById(id);
    }

    @PostMapping("insert")
    private CommonResult insert(@RequestBody TbBrand tbBrand){
        return carBrandService.insertBrand(tbBrand);
    }

    @PutMapping("updateCarBrand")
    private CommonResult updateCartype(@RequestBody TbBrand tbBrand){
        return carBrandService.updateBrandyId(tbBrand);
    }

}
